package com.github.soiff.shadow.plugin.helper;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;
import com.google.common.base.Objects;

import java.io.IOException;

/**
 * Created by Soiff on 2016/05/20.
 *
 * @author : Soiff
 */
public class EqualsHelper implements Helper {
    @Override
    public CharSequence apply(Object source, Options options) throws IOException {
        return Objects.equal(String.valueOf(source), String.valueOf(options.param(0)))?options.fn():options.inverse();
    }
}
